package download

import (
	"bytes"
	"io"
	"io/ioutil"
	"net/http"
	"os"
)

func Download(imgUrl string, name string) {
	//通过http请求获取图片的流文件
	resp, _ := http.Get(imgUrl)
	body, _ := ioutil.ReadAll(resp.Body)
	out, _ := os.Create("C:\\Users\\admin\\GolandProjects\\waimaigo\\png\\" + name + ".jpg")
	io.Copy(out, bytes.NewReader(body))
}
